public  key_check

ss8      segment     code
rseg    ss8

extrn   code(write_com)
extrn   code(write_data)

key1    bit     p3.6
key2    bit     p3.7

key_vail    bit     20h.0








;---------------------------------------------
key_check:
    jnb     key1,next0_key_check
    sjmp    exit_key_check    
    
next0_key_check :
    call    debounce
    jnb     key1, set_vail_key
    sjmp    exit_key_check

set_vail_key:
    setb    key_vail


exit_key_check:
    ret



;---------------------------------------------   
        
    
    
            

debounce:
    mov     r7,#50
d1:
    mov     r6,#200
    djnz    r6,$
    djnz    r7,d1
    ret


end